import { createRouter, createWebHashHistory } from 'vue-router'
import { RouteRecordRaw } from 'vue-router'

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/main'
  },
  {
    path: '/main',
    name: 'main',
    component: () => import('../views/main/main.vue'),
    redirect: '/main/recommend',
    children: [
      {
        path: 'recommend',
        name: 'mainRecommend',
        component: () => import('@/views/main/recommend/recommend.vue')
      },
      {
        path: 'rank',
        name: 'mainRank',
        component: () => import('@/views/main/rank/rank.vue')
      },
      {
        path: 'sheet',
        name: 'mainSheet',
        component: () => import('@/views/main/sheet/sheet.vue')
      },
      {
        path: 'djradio',
        name: 'mainSinger',
        component: () => import('@/views/main/djradio/djradio.vue')
      },
      {
        path: 'sheetdetail',
        name: 'mainSheetdetail',
        component: () => import('@/views/main/details/sheet-detail.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/login.vue')
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'notFound',
    component: () => import('@/views/not-found/not-found.vue')
  }
]

const router = createRouter({
  routes,
  history: createWebHashHistory()
})

export default router
